{% extends 'base.html' %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

{% block title %}
    用户中心
{% endblock %}
{% block styles %}
    {{ super() }}
    <!--<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='/css/center.css')}}">-->
    <link rel="stylesheet" href="/static/css/center.css">
{% endblock %}

{% block newcontent %}
    <div id="container">
        <div id="left">
            <p>用户信息修改</p>
            <p>发表文章</p>
            <p>管理相册</p>
            <p>管理留言</p>
            <p>关于我设置</p>
        </div>
        <div id="right">
            <div class="right1">
                <h2>用户信息修改</h2>
                <form action="{{ url_for('user.user_change') }}" method="post" enctype="multipart/form-data">
                    <p><input type="text" class="form-control" id="InputUsername" name="username"
                              value="{{ g.user.username }}">
                    </p>
                    <p><input type="text" class="form-control" id="InputPhone" name="phone"
                              value="{{ g.user.phone }}"><span></span>
                    </p>
                    <p><input type="text" class="form-control" id="InputEmail1" name="email"
                              value="{{ g.user.email }}">
                    </p>
                    <p><input type="file" id="exampleInputFile" name="icon"></p>
                    <p>
                        <img src="
                                {% if g.user.icon %}{{ url_for('static',filename=user.icon) }} {% else %}{{ url_for('static',filename='images/touxiang.jpg') }}{% endif %}"
                             alt="" width="90" height="100">
                    </p>
                    <p>
                        <button type="submit" class="btn btn-primary">用户信息修改</button>
                    </p>
                </form>

            </div>
            <div class="right1" style="padding-top: 20px">
                <form action="{{ url_for('article.publish_article') }}" method="post">
                    <p><input type="text" class="form-control" id="InputTitle" name="title"
                              placeholder="请输入文章标题">
                    </p>
                    <p>
                        <select name="type" class="form-control">
                            <option value="0">请选择文章分类</option>
                            {% for type in types %}
                                <option value="{{ type.id }}">{{ type.type_name }}</option>
                            {% endfor %}
                        </select>
                    </p>
                    <p>
                    <textarea name="content" class="mytextarea">
                    </textarea>
                    </p>
                    <p style="text-align: right;">
                        <button type="submit" class="btn btn-primary publish_article">发表文章</button>
                    </p>
                </form>
            </div>
            <div class="right1">
                <form action="{{ url_for('user.upload_photo') }}" method="post" enctype="multipart/form-data"
                      class="form-inline">
                    <input type="file" name="photo" class="form-control">
                    <input type="submit" value="上传相册" class="btn btn-default">
                </form>
                <div class="row">
                    <div class="clo-sm-12">
                        <h3>我的相册</h3>
                        <div class="row">
                            {% for photo in photos %}
                                <div class="clo-xs-8 clo-sm-4">
                                    <img src="http://qx7v5ct15.hd-bkt.clouddn.com/{{ photo.photo_name }}"
                                         alt="..." class="img-rounded image">
                                    <button class="btn btn-info btn-xs photo_del" tag="{{ photo.id }}">删除</button>
                                </div>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            </div>
            <div class="right1" style="padding-top: 30px;width: 90%">
                {% if user.messages %}
                    <table class="table table-hover">
                        <tr>
                            <th>序号</th>
                            <th>留言内容</th>
                            <th>时间</th>
                            <th>操作</th>
                        </tr>
                        {% for message in user.messages %}
                            <tr {% if loop.index%2==0 %}class="warning" {% endif %}>
                                <td>{{ loop.index }}</td>
                                <td>{{ message.content }}</td>
                                <td>{{ message.mdatetime }}</td>
                                <td><a href="{{ url_for('user.delete_board') }}?bid={{ message.id }}"
                                       class="board_del" tag="{{ types.id }}">删除留言</a></td>
                            </tr>
                        {% endfor %}

                    </table>
                {% else %}
                    <p>还没有任何内容，可以去留言板区发言......</p>
                {% endif %}

            </div>
            <div class="right1" style="padding-top: 30px">
                <form action="{{ url_for('user.about_me') }}" method="post" enctype="multipart/form-data">
                    <p>
                    <textarea name="about" class="mytextarea">
                    </textarea>
                    </p>
                    <p></p>
                    <p style="text-align: right;">
                        <button type="submit" class="btn btn-primary">更改我的设置</button>
                    </p>
                </form>
            </div>
        </div>
    </div>
{% endblock %}

{% block scripts %}
    {{ super() }}
    <!--<scirpt src="{{url_for('static',filename='tinymce/tinymce.min.js')}}"></scirpt>-->
    <script src="/static/tinymce/tinymce.min.js"></script>
    <script src="{{ url_for('static',filename='js/center.js') }}"></script>
    <!--<script src="/static/js/center.js"></script>-->
{% endblock %}


